<template>
  <el-container>
    <el-header>登录界面</el-header>
    <el-main>
      <el-input v-model="user.userID" placeholder="输入电话号码"></el-input>
      <el-input v-model="user.password" placeholder="输入密码"></el-input>
      <el-button @click="jump('/register')">注册</el-button>
      <el-button @click="login">登录</el-button>
    </el-main>
  </el-container>
</template>

<script>
export default {
    name: "Login",
    data() {
        return {
            user: {
                userID: '',
                password: ''
            }
        }
    },
    methods: {
        login(){
            let user = this.$qs.stringify(this.user);
            this.$http.post(this.$api.login,user
            )
              .then(res=>
              console.log(res))
              .catch(err=>
              console.log(err))
        },
        jump(route) {
            this.$router.push(route);
        }
    }
}
</script>

<style scoped>

</style>
